﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Reviewer.Entities.Services;
using Reviewer.Data;
using System.Web;
using Reviewer.Entities;
using System.Web.Caching;
using System.Collections.ObjectModel;

namespace Reviewer.Business.Services
{
    internal class FrontPagePostImageService : BaseService, IFrontPagePostImageService, IFrontPagePostImageAdminService
    {
        internal FrontPagePostImageService() : base() { }

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }

        #region IFrontPagePostImageService Members

        public ICollection<FrontPagePostImage> Find()
        {
            return new FrontPagePostImageRepository().SelectAll();
        }

        public FrontPagePostImage Find(int id)
        {
            return new FrontPagePostImageRepository().SelectBy(id);
        }

        #endregion

        #region IFrontPagePostImageAdminService Members

        public FrontPagePostImage Save(FrontPagePostImage post)
        {
            if (post.Id > 0)
            {
                return new FrontPagePostImageRepository().Update(post);
            }
            else
            {
                return new FrontPagePostImageRepository().Create(post);
            }
        }

        #endregion
    }
}
